/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.cashmate.struts;

import com.cashmate.hibernate.dao.CollectionsDAO;
import com.cashmate.hibernate.pojo.Collections;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ServletActionContext;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;

/**
 *
 * @author Sarah
 */

public class GetSequence extends ActionSupport {

    private CollectionsDAO cr = (CollectionsDAO) ServletActionContext.getServletContext().getAttribute("collectionsDAO");
    private Collections collection;
    

    public Collections getCollection() {
        return collection;
    }


    @Action(value = "/get-sequence", results = {
        @Result(name = "success", type="redirect", location = "../../loancollection.jsp")
    })
    public String getSequence() {
        try {
            collection = cr.getLastCollection();
            return SUCCESS;

        } catch(NullPointerException ne){
            
        }catch (Exception e) {
            System.out.println("collerr"+e.toString());
        }
        return SUCCESS;
    }
}
